<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <el-form style="margin-bottom: 10px" size="small" label-width="90px" ref="orderForm" :rules="rules"
               :model="crud.order"
               :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'">
        <el-row :gutter="10">
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="业务日期" prop="busDate">
              <el-date-picker
                :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
                v-model="crud.order.busDate"
                type="date"
                style="width: 100%;"
                format="yyyy - MM - dd "
                value-format="yyyy-MM-dd"
                default-value
                placeholder="选择日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="单据编号">
              <el-input :disabled="true" v-model="crud.order.code" placeholder="系统自动生成"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="往来单位" prop="supplierId">
              <zSelect :value.sync="crud.order.supplierId" :showName="crud.order.supplierName"
                       url="api/dropDown/basCustomerList"
                       :params="{ isContact: '1,2' }"
                       style="width:  100%" @change="updateCustom"/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="部门" prop="deptId">
              <zSelect :value.sync="crud.order.deptId" :showName="crud.order.deptName"
                       url="api/dropDown/childSysDeptList"
                       @change="changeDept"
                       style="width:  100%"/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="业务员" prop="userId">
              <zSelect :value.sync="crud.order.userId" :showName="crud.order.userName" url="api/dropDown/sysUserList"
                       :params="userParams"
                       style="width:  100%;"/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="收回类型" prop="type">
              <el-select v-model="crud.order.type" class="filter-item" clearable placeholder="状态" size="small"
                         style="width: 100%;">
                <el-option
                  v-for="item in dict.t_fee_back_type"
                  :key="item.id"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
            <el-form-item label="收回金额" prop="backAmount">
              <el-input-number
                :disabled="true"
                style="width:100%"
                v-model="crud.order.backAmount"
                :precision="2"
                :step="0.1"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
            <el-form-item label="备注">
              <el-input v-model="crud.order.remark" placeholder="请输入备注"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--   操作栏   -->
      <div>
        <el-button slot="right" class="filter-item" :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'" size="mini"
                   type="primary" @click="submit()">
          保存
        </el-button>
        <el-button slot="right" class="filter-item" size="mini" type="success"
                   :disabled="crud.order.orderStatus !== 'SAVE'"
                   :loading="crud.passLoading" @click="crud.doDetailPassOrReject('PASS',id)">
          审核
        </el-button>
        <el-button slot="right" class="filter-item" size="mini" type="info" :loading="crud.rejectLoading"
                   :disabled="crud.order.orderStatus !== 'PASS'" @click="crud.doDetailPassOrReject('REJECT',id)">
          反审
        </el-button>
        <el-button slot="right" class="filter-item" size="mini" type="info" :loading="crud.rejectLoading"
                   :disabled="$route.params.id=='null'">
          打印
        </el-button>
        <el-button slot="right" class="filter-item" size="mini" type="info" :loading="crud.rejectLoading"
                   :disabled="$route.params.id=='null'">
          打印预览
        </el-button>
        <el-button slot="right" class="filter-item" size="mini" type="info" @click="getOrder()"
                   :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'">
          申请抽单
        </el-button>
        <el-button :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'" slot="right" class="filter-item" size="mini" type="info" :loading="crud.rejectLoading"
                   @click="addBankData">
          添加银行
        </el-button>
      </div>
      <el-table ref="bank-table" stripe border v-loading="crud.loading" :row-class-name="crud.tableRowClassName"
                :data="crud.order.feeBackBankDtos"
                size="small" style="width: 100%;"
                :show-summary="true"
                :summary-method="sumBank"
                sortable="custom">
        <el-table-column :render-header="crud.renderHeader" type="selection" width="60"/>
        <el-table-column :render-header="crud.renderHeader" v-if="false" prop="bankName" label="银行名称"/>
        <el-table-column width="150" :render-header="crud.renderHeader" v-if="columns.visible('bankId')" prop="bankId"
                         label="银行">
          <template slot-scope="{row,$index}">
            <zSelect :value.sync="row.bankId"
                     :showName="row.bankName"
                     :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
                     url="api/basBank/getBasBanksById"
                     :labelKey="'bankName'"
                     :params="{sort: 'seq desc'}"
                     :valueKey="'bankId'"
                     style="width:  100%;"
                     @change="bankSelectFunc($index,$event)"
            />
          </template>
        </el-table-column>
        <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('bankOpenBranch')"
                         prop="bankOpenBranch" label="银行支行"
                         width="200"/>
        <el-table-column width="160" :render-header="crud.renderHeader" v-if="columns.visible('bankAccount')"
                         prop="bankAccount"
                         label="银行账户"/>
        <el-table-column width="160" :render-header="crud.renderHeader" v-if="columns.visible('taxAmount')"
                         prop="taxAmount"
                         label="金额">
          <template slot-scope="{row}">
            <el-input-number
              style="width:100%"
              :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
              v-model="row.taxAmount"
              :precision="2"
              :step="0.1"
              @change="changeBankAmount"
            />
          </template>
        </el-table-column>
        <el-table-column width="200" :render-header="crud.renderHeader" v-if="columns.visible('remark')" prop="remark"
                         label="备注">
          <template slot-scope="{row}">
            <el-input
              :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
              style="width:100%"
              v-model="row.remark"
              placeholder="请输入备注"
            />
          </template>
        </el-table-column>
        <el-table-column width="120" :render-header="crud.renderHeader" v-if="columns.visible('balanceAmount')"
                         prop="balanceAmount"
                         label="银行余额"/>
        <el-table-column :render-header="crud.renderHeader" label="操作" fixed="right" align="center">
          <template slot-scope="scope">
            <el-button
              slot="reference" class="el-icon-delete opration_icon_btn"
              :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
              style="border: none;width: auto;height: auto"
              @click="bankDelAddRow(scope.$index)"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <hr style="margin: 20px 0">
      <!--表格渲染-->
      <el-table ref="table" stripe border v-loading="crud.loading" :data="crud.order.feeBackOrderDtos" size="small"
                style="width: 100%;"
                @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55"/>
        <el-table-column type="index" width="60" label="序号"/>
        <el-table-column width="120" v-if="columns.visible('feeType')" prop="feeType" label="费用类型">
          <template slot-scope="scope">
            <span v-for="item in dict.t_fee_order_type" v-if="item.value == scope.row.feeType">{{
                item.label
              }}</span>
          </template>
        </el-table-column>
        <el-table-column width="160" v-if="columns.visible('sourceCode')" prop="sourceCode" label="单据编号"/>
        <el-table-column width="160" v-if="columns.visible('supplierName')" prop="supplierName" label="客户名称"/>
        <el-table-column width="160" v-if="columns.visible('feeAmount')" prop="feeAmount" label="金额">
          <template slot-scope="scope">
            {{ scope.row.feeAmount.toFixed(2) }}
          </template>
        </el-table-column>
        <el-table-column width="160" v-if="columns.visible('cancelAmount')" prop="cancelAmount" label="已核销金额">
          <template slot-scope="scope">
            {{ scope.row.cancelAmount.toFixed(2) }}
          </template>
        </el-table-column>
        <el-table-column width="160" v-if="columns.visible('unCancelAmount')" prop="unCancelAmount" label="未核销金额">
          <template slot-scope="scope">
            {{ scope.row.unCancelAmount.toFixed(2) }}
          </template>
        </el-table-column>
        <el-table-column width="160" v-if="columns.visible('curCancelAmount')" prop="curCancelAmount" label="本次核销金额">
          <template slot-scope="{row}">
            <span>
              <el-input-number
                :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
                style="width:100%"
                v-model="row.curCancelAmount"
                :precision="2"
                :step="0.1"
                @change="changeOrderCurCancelAmount"
              ></el-input-number>
            </span>
          </template>
        </el-table-column>
        <el-table-column width="160" :render-header="crud.renderHeader" v-if="columns.visible('remark')" prop="remark" label="备注"/>
        <el-table-column :render-header="crud.renderHeader" label="操作" fixed="right" align="center">
          <template slot-scope="scope">
            <el-button
              slot="reference" class="el-icon-delete opration_icon_btn"
              :disabled="crud.order.orderStatus==='PASS' || crud.order.orderStatus==='CLOSE'"
              style="border: none;width: auto;height: auto"
              @click="delAddRow(scope.$index)"></el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-dialog title="申请抽单" :top="orderTop" :visible.sync="showReceiptOrder" width="80%">
        <div>
          <el-form size="small" label-width="100px" :model="receiptOrderQuery">
            <el-row :gutter="10">
              <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
                <el-form-item label="单据编号">
                  <el-input v-model="receiptOrderQuery.code" placeholder="支持模糊查询"></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
                <el-form-item label="备注">
                  <el-input v-model="receiptOrderQuery.remark" placeholder="单行输入"></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
                <el-button type="primary" @click="receiptOrderSizeChangeHandler(10)">搜索</el-button>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <hr style="margin: 20px 0">
        <el-table ref="table" stripe border height="480" :row-class-name="crud.tableRowClassName"
                  v-loading="receiptOrderLoading"
                  :data="receiptOrderTableData" size="small" style="width: 100%;"
                  @selection-change="receiptOrderSelection">
          <el-table-column :render-header="crud.renderHeader" type="selection" width="60"/>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('busDate')" prop="busDate"
                           label="业务日期"/>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('code')" prop="code"
                           label="单据编号"/>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('supplierName')" prop="supplierName"
                           label="供应商名称"/>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('feeAmount')" prop="feeAmount"
                           label="金额">
            <template slot-scope="scope">
              {{ scope.row.feeAmount.toFixed(2) }}
            </template>
          </el-table-column>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('cancelAmount')" prop="cancelAmount"
                           label="已核销金额">
            <template slot-scope="scope">
              {{ scope.row.cancelAmount.toFixed(2) }}
            </template>
          </el-table-column>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('unCancelAmount')"
                           prop="unCancelAmount" label="未核销金额">
            <template slot-scope="scope">
              {{ scope.row.unCancelAmount.toFixed(2) }}
            </template>
          </el-table-column>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('curCancelAmount')"
                           prop="curCancelAmount" label="本次核销金额">
            <template slot-scope="scope">
              {{ scope.row.curCancelAmount===undefined?0:scope.row.curCancelAmount.toFixed(2) }}
            </template>
          </el-table-column>
          <el-table-column :render-header="crud.renderHeader" v-if="columns.visible('remark')" prop="remark"
                           label="备注"/>
        </el-table>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="showReceiptOrder = false">取消</el-button>
          <el-button :loading="crud.cu === 2" type="primary" @click="receiptOrderConfirm">确认</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import crudFeeBack from '@/api/erp/feeBack'
import crudFeePayBank from '@/api/erp/feePayBank'
import CRUD, {crud, form, header, presenter} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import {getBusTime} from "@/utils";
import {Notification} from "element-ui";

// crud交由presenter持有
const defaultCrud = CRUD({
  title: '费用支付银行明细',
  sort: 'id,desc',
  order: {
    backAmount: 0.00,
    type:1,
    busDate: getBusTime(),
    feeBackBankDtos: [],
    feeBackOrderDtos: [],

  },
  params() {
    const href = location.href.split('/')
    return {
      id: href[href.length - 1] == 'add' ? 0 : href[href.length - 1],
    }
  },
  url: 'api/feeBack/detail',
  crudMethod: {...crudFeeBack}
})
const defaultForm = {
  id: null,
  orderId: null,
  bankId: null,
  bankCode: null,
  bankName: null,
  bankAccount: null,
  bankOpenName: null,
  bankOpenBranch: null,
  taxAmount: null,
  balanceAmount: null,
  seq: null,
  remark: null,
  createUserId: null,
  createUserCode: null,
  createUserName: null,
  createTime: null,
  updateUserId: null,
  updateUserCode: null,
  updateUserName: null,
  updateTime: null
}
export default {
  name: 'FeePayBank',
  components: {pagination, crudOperation, rrOperation, udOperation},
  mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
  dicts: ['t_fee_pay_type', 't_fee_order_type', 't_fee_back_type'],
  data() {
    return {
      permission: {
        add: ['admin', 'feePayBank:add'],
        edit: ['admin', 'feePayBank:edit'],
        del: ['admin', 'feePayBank:del'],
        import: ['admin', 'feePayBank:import'],
        export: ['admin', 'feePayBank:export'],
        copy: ['admin', 'feePayBank:copy'],
        upload: ['admin', 'feePayBank:upload'],
        download: ['admin', 'feePayBank:download'],
      },
      rules: {
        busDate: [
          {required: true, message: '业务日期不能为空', trigger: 'blur'}
        ],
        supplierId: [
          {required: true, message: '往来单位不能为空', trigger: 'blur'}
        ],
        deptId: [
          {required: true, message: '部门不能为空', trigger: 'blur'}
        ],
        userId: [
          {required: true, message: '业务员不能为空', trigger: 'blur'}
        ],
        type: [
          {required: true, message: '支付类型不能为空', trigger: 'blur'}
        ],
        backAmount: [
          {required: true, message: '支付总额不能为空', trigger: 'blur'}
        ],
      },
      userParams: {
        deptId: null
      },
      orderTop: "0.2vh",
      showReceiptOrder: false,
      receiptOrderQuery: {
        customerId: this.crud.order.supplierId
      },
      pageable: {},
      receiptOrderTableData: [],// 收款单单据明细
      receiptOrderLoading: false, //
      enable: false,
      able: false
    }
  },
  watch: {},
  destroyed() {
    this.crud.setItemInfo("feeBackDetail_add")
  },
  created() {
    if (this.$route.params.id == 'add') {
      if (this.crud.getItemInfo("feeBackDetail_add")) {
        return false
      }
      this.crud.order = {
        backAmount: 0.00,
        type:1,
        busDate: getBusTime(),
        feeBackBankDtos: [],
        feeBackOrderDtos: [],
      }
    }
  },
  methods: {
    // 获取数据前设置好接口地址
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }, // 新增与编辑前做的操作
    [CRUD.HOOK.afterToCU](crud, form) {
    },
    changeDept(e) {
      const {id} = e
      this.userParams.deptId = id
    },
    submit() {
      this.$refs['orderForm'].validate(valid => {
        if (!valid) {
          return
        }
        const bank_rules = [
          {name: '银行', value: 'bankId'},
          {name: '金额', value: 'taxAmount'}
        ]
        let bankList = this.crud.order.feeBackBankDtos
        if (!this.tableRules(bankList, bank_rules, "请选择银行支付")) {
          return;
        }
        const order_rules = [
          {name: '本次核销金额', value: 'curCancelAmount'}
        ]
        let orderList = this.crud.order.feeBackOrderDtos
        if (!this.tableRules(orderList, order_rules, "您还没有抽单")) {
          return;
        }
        this.save()
      });
    },
  tableRules(list, rules, nullMsg) {
      let flag = true
      if (list === null || list.length === 0) {
        Notification.error({title: nullMsg})
        return false
      }
      rules.forEach(rule => {
        for (let i = 0; i < list.length; i++) {
          if (!list[i][rule.value]) {
            Notification.error({title: '序号【' + (i + 1) + '】' + rule.name + '不能为空'})
            flag = false
            break
          }
        }
      })
      return flag
    },
    save() {
      let that = this
      let params = this.crud.order
      crudFeeBack.add(params).then(res => {
        if (res.success) {
          this.crud.order = res.data.order
          let id = this.crud.order.id
          if (this.$route.params.id == 'add') {
            this.$store.dispatch("tagsView/delView", this.$route);
            this.$router.push({params: {id}})
            this.crud.cleanItemInfo("feeBackDetail_add")
          }
          this.$message({
            message: '保存成功',
            type: 'success'
          })
          that.crud.loadingClose()
        } else {
          that.crud.loadingClose()
          this.$message({
            message: res.msg,
            type: 'warning'
          })
        }

      }).catch((res) => {
        that.crud.loadingClose()
      })
    },
    // 添加银行数据
    addBankData() {
      let bankItem = {
        bankId: '',
        bankName: '',
        bankOpenBranch: '',
        bankAccount: '',
        balanceAmount: 0.00,
        taxAmount: 0.00,
        remark: '',
      }
      this.crud.order.feeBackBankDtos.push(bankItem);
    },
    receiptOrderSizeChangeHandler(e) {
      this.pageable.page = 1
      this.pageable.size = e
      this.getOrder()
    },
    getOrder() {
      if (!this.crud.order.supplierId) {
        this.$message.warning("请选择往来单位")
        return
      }
      let params = {
        supplierId: this.crud.order.supplierId,
        type:'1,3',
        isRepeatDraw:0,
        isFeeBackAdvanceRepeatDraw:0,
        isFeeBackDraw:1,
        code:this.receiptOrderQuery.code,
        remark:this.receiptOrderQuery.remark
      }
      console.log(params)
      this.receiptOrderLoading = true
      crudFeePayBank.getFeeOrderDrawSheet(params).then(res => {
        this.receiptOrderTableData = res.data.content
        this.showReceiptOrder = true
        this.receiptOrderLoading = false
      }).finally(() => {
        this.receiptOrderLoading = false
      })
    },
    // 选中收款单单据
    receiptOrderSelection(rows) {
      if (rows) {
        this.selectedRows = rows
      }
    },
    updateCustom(e) {
      this.crud.order.supplierId = e.id
      this.crud.order.supplierName = e.name
      this.crud.order.supplierCode = e.code
      this.receiptOrderQuery.customerId = e.id
    },
    // 收款单单据弹窗点击确定
    receiptOrderConfirm(e) {
      if (!this.selectedRows) {
        this.$message.error("请选择抽单数据")
        return
      }
      this.selectedRows.forEach(row => {
        const sourceCode = row.code
        let flag = this.checkSourceCode(row)
        if (flag) {
          this.$message.error("单据编号已存在，请核查！")
          return false
        }
        let item = {
          busDate: row.busDate,
          sourceType: row.type===3?9:row.type,
          sourceId: row.id,
          feeType: row.type,
          sourceCode: sourceCode,
          supplierName: row.customerName,
          supplierId: row.customerId,
          supplierCode: row.customerCode,
          feeAmount: row.feeAmount,
          cancelAmount: row.cancelAmount,
          unCancelAmount: row.unCancelAmount,
          curCancelAmount: row.unCancelAmount,
          tailAmount: row.tailAmount,
          remark: row.remark
        }
        this.crud.order.feeBackOrderDtos.push(item)
      })
      this.showReceiptOrder = false
    },
    checkSourceCode(row) {
      let flag = false
      if (this.crud.order.feeBackOrderDtos) {
        for (let i = 0; i < this.crud.order.feeBackOrderDtos.length; i++) {
          if (this.crud.order.feeBackOrderDtos[i].code === row.code) {
            flag = true
          }
        }
      }
      return flag
    },
    sumBank({columns, data}) {
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (column.property == 'taxAmount' || column.property == 'balanceAmount') {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0).toFixed(2);
        }
      });
      return sums
    },
    changeBankAmount(e) {
      this.sumAmount()
    },
    sumAmount() {
      debugger
      this.crud.order.backAmount = 0.00
      for (let i = 0; i < this.crud.order.feeBackBankDtos.length; i++) {
        this.crud.order.backAmount += this.crud.order.feeBackBankDtos[i].taxAmount
      }
    },
    // 删除银行
    bankDelAddRow(i) {
      this.crud.order.feeBackBankDtos.splice(i, 1)
      this.sumAmount()
    },
    // 选择银行之后
    bankSelectFunc(idx, selectedBank) {
      const {id, name, bankOpenBranch, bankAccount, balanceAmount, taxAmount, remark} = selectedBank;
      this.crud.order.feeBackBankDtos[idx].bankId = id
      this.crud.order.feeBackBankDtos[idx].bankName = name
      this.crud.order.feeBackBankDtos[idx].bankOpenBranch = bankOpenBranch
      this.crud.order.feeBackBankDtos[idx].bankAccount = bankAccount
      this.crud.order.feeBackBankDtos[idx].balanceAmount = balanceAmount
      this.crud.order.feeBackBankDtos[idx].remark = remark
    },
    changeOrderCurCancelAmount() {
      let curCancelAmount = 0.00
      for (let i = 0; i < this.crud.order.feeBackOrderDtos.length; i++) {
        curCancelAmount += this.crud.order.feeBackOrderDtos[i].curCancelAmount
      }
      this.crud.order.backAmount = curCancelAmount
    },
    delAddRow(i) {
      if (this.$route.params.id !== 'add') {
        this.$confirm('此操作将直接删除此条产品记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.crud.order.feeBackOrderDtos.splice(i, 1)
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
          this.changeOrderCurCancelAmount()
          this.changeOrderTailAmount()
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      } else {
        this.crud.order.feeBackOrderDtos.splice(i, 1)
      }
    },
  }
}
</script>

<style scoped>
.table-img {
  display: inline-block;
  text-align: center;
  background: #ccc;
  color: #fff;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  vertical-align: middle;
  width: 32px;
  height: 32px;
  line-height: 32px;
}
</style>
